/*
 * Powered By [pkuWx]
 * Web Site: http://www.wuxi.ss.pku.edu.cn
 * Since 2015 - 2015
 */

package cn.edu.pku.wxlib.periodical.model;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import cn.org.rapid_framework.util.DateConvertUtils;

import java.util.*;

import cn.edu.pku.wxlib.periodical.model.*;
import cn.edu.pku.wxlib.periodical.service.*;
import cn.edu.pku.wxlib.periodical.vo.query.*;

import javacommon.base.*;
import javacommon.util.*;
import javacommon.page.Page;

/**
 * @version 1.0
 * @since 1.0
 */


public class Periodical extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "Periodical";
	public static final String ALIAS_PERIODICAL_ID = "periodicalId";
	public static final String ALIAS_ISSN = "issn";
	public static final String ALIAS_POST_CODE = "邮发代号";
	public static final String ALIAS_PERIODICAL_NAME = "periodicalName";
	public static final String ALIAS_FREQUENCY = "出版周期[1旬刊/2半月刊/3月刊/4双月刊/5季刊/6半年刊/7年刊]";
	public static final String ALIAS_VOLUME = "卷";
	public static final String ALIAS_YEAR = "年";
	public static final String ALIAS_PERIOD = "期";
	public static final String ALIAS_PUBLISHER = "出版社";
	public static final String ALIAS_BRIEF = "简介";
	public static final String ALIAS_PRICE = "价格";
	public static final String ALIAS_LANGUAGE = "语言";
	public static final String ALIAS_PUBLISH_TIME = "发行时间";
	public static final String ALIAS_CREATE_TIME = "createTime";
	public static final String ALIAS_CATEGORY_ID = "类型ID";
	public static final String ALIAS_SHELF_ID = "书架ID";
	public static final String ALIAS_STATE = "1在架，2下架，3报废";
	public static final String ALIAS_TOTAL_NUMBER = "入库数量";
	public static final String ALIAS_AUTHOR = "author";
	public static final String ALIAS_IMAGE_URL = "imageUrl";
	
	//date formats
	public static final String FORMAT_PUBLISH_TIME = DATE_FORMAT;
	public static final String FORMAT_CREATE_TIME = DATE_FORMAT;
	
	//columns START
    /** periodicalId       db_column: periodicalId */	
	
	private java.lang.Integer periodicalId;
    /** issn       db_column: ISSN */	
	@NotBlank @Length(max=13)
	private java.lang.String issn;
    /** 邮发代号       db_column: postCode */	
	@Length(max=6)
	private java.lang.String postCode;
    /** periodicalName       db_column: periodicalName */	
	@NotBlank @Length(max=64)
	private java.lang.String periodicalName;
    /** 出版周期[1旬刊/2半月刊/3月刊/4双月刊/5季刊/6半年刊/7年刊]       db_column: frequency */	
	
	private java.lang.Integer frequency;
    /** 卷       db_column: volume */	
	
	private java.lang.Integer volume;
    /** 年       db_column: year */	
	
	private java.lang.Integer year;
    /** 期       db_column: period */	
	
	private java.lang.Integer period;
    /** 出版社       db_column: publisher */	
	@Length(max=64)
	private java.lang.String publisher;
    /** 简介       db_column: brief */	
	@Length(max=1024)
	private java.lang.String brief;
    /** 价格       db_column: price */	
	
	private java.lang.Double price;
    /** 语言       db_column: language */	
	@Length(max=32)
	private java.lang.String language;
    /** 发行时间       db_column: publishTime */	
	
	private java.util.Date publishTime;
    /** createTime       db_column: createTime */	
	
	private java.util.Date createTime;
    /** 类型ID       db_column: categoryId */	
	
	private java.lang.Integer categoryId;
    /** 书架ID       db_column: shelfId */	
	
	private java.lang.Integer shelfId;
    /** 1在架，2下架，3报废       db_column: state */	
	
	private java.lang.Integer state;
    /** 入库数量       db_column: totalNumber */	
	
	private java.lang.Integer totalNumber;
    /** author       db_column: author */	
	@Length(max=128)
	private java.lang.String author;
    /** imageUrl       db_column: imageUrl */	
	@Length(max=128)
	private java.lang.String imageUrl;
	//columns END

	public Periodical(){
	}

	public Periodical(
		java.lang.Integer periodicalId
	){
		this.periodicalId = periodicalId;
	}

	public void setPeriodicalId(java.lang.Integer value) {
		this.periodicalId = value;
	}
	
	public java.lang.Integer getPeriodicalId() {
		return this.periodicalId;
	}
	public void setIssn(java.lang.String value) {
		this.issn = value;
	}
	
	public java.lang.String getIssn() {
		return this.issn;
	}
	public void setPostCode(java.lang.String value) {
		this.postCode = value;
	}
	
	public java.lang.String getPostCode() {
		return this.postCode;
	}
	public void setPeriodicalName(java.lang.String value) {
		this.periodicalName = value;
	}
	
	public java.lang.String getPeriodicalName() {
		return this.periodicalName;
	}
	public void setFrequency(java.lang.Integer value) {
		this.frequency = value;
	}
	
	public java.lang.Integer getFrequency() {
		return this.frequency;
	}
	public void setVolume(java.lang.Integer value) {
		this.volume = value;
	}
	
	public java.lang.Integer getVolume() {
		return this.volume;
	}
	public void setYear(java.lang.Integer value) {
		this.year = value;
	}
	
	public java.lang.Integer getYear() {
		return this.year;
	}
	public void setPeriod(java.lang.Integer value) {
		this.period = value;
	}
	
	public java.lang.Integer getPeriod() {
		return this.period;
	}
	public void setPublisher(java.lang.String value) {
		this.publisher = value;
	}
	
	public java.lang.String getPublisher() {
		return this.publisher;
	}
	public void setBrief(java.lang.String value) {
		this.brief = value;
	}
	
	public java.lang.String getBrief() {
		return this.brief;
	}
	public void setPrice(java.lang.Double value) {
		this.price = value;
	}
	
	public java.lang.Double getPrice() {
		return this.price;
	}
	public void setLanguage(java.lang.String value) {
		this.language = value;
	}
	
	public java.lang.String getLanguage() {
		return this.language;
	}
	public String getPublishTimeString() {
		return DateConvertUtils.format(getPublishTime(), FORMAT_PUBLISH_TIME);
	}
	public void setPublishTimeString(String value) {
		setPublishTime(DateConvertUtils.parse(value, FORMAT_PUBLISH_TIME,java.util.Date.class));
	}
	
	public void setPublishTime(java.util.Date value) {
		this.publishTime = value;
	}
	
	public java.util.Date getPublishTime() {
		return this.publishTime;
	}
	public String getCreateTimeString() {
		return DateConvertUtils.format(getCreateTime(), FORMAT_CREATE_TIME);
	}
	public void setCreateTimeString(String value) {
		setCreateTime(DateConvertUtils.parse(value, FORMAT_CREATE_TIME,java.util.Date.class));
	}
	
	public void setCreateTime(java.util.Date value) {
		this.createTime = value;
	}
	
	public java.util.Date getCreateTime() {
		return this.createTime;
	}
	public void setCategoryId(java.lang.Integer value) {
		this.categoryId = value;
	}
	
	public java.lang.Integer getCategoryId() {
		return this.categoryId;
	}
	public void setShelfId(java.lang.Integer value) {
		this.shelfId = value;
	}
	
	public java.lang.Integer getShelfId() {
		return this.shelfId;
	}
	public void setState(java.lang.Integer value) {
		this.state = value;
	}
	
	public java.lang.Integer getState() {
		return this.state;
	}
	public void setTotalNumber(java.lang.Integer value) {
		this.totalNumber = value;
	}
	
	public java.lang.Integer getTotalNumber() {
		return this.totalNumber;
	}
	public void setAuthor(java.lang.String value) {
		this.author = value;
	}
	
	public java.lang.String getAuthor() {
		return this.author;
	}
	public void setImageUrl(java.lang.String value) {
		this.imageUrl = value;
	}
	
	public java.lang.String getImageUrl() {
		return this.imageUrl;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("PeriodicalId",getPeriodicalId())
			.append("Issn",getIssn())
			.append("PostCode",getPostCode())
			.append("PeriodicalName",getPeriodicalName())
			.append("Frequency",getFrequency())
			.append("Volume",getVolume())
			.append("Year",getYear())
			.append("Period",getPeriod())
			.append("Publisher",getPublisher())
			.append("Brief",getBrief())
			.append("Price",getPrice())
			.append("Language",getLanguage())
			.append("PublishTime",getPublishTime())
			.append("CreateTime",getCreateTime())
			.append("CategoryId",getCategoryId())
			.append("ShelfId",getShelfId())
			.append("State",getState())
			.append("TotalNumber",getTotalNumber())
			.append("Author",getAuthor())
			.append("ImageUrl",getImageUrl())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getPeriodicalId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof Periodical == false) return false;
		if(this == obj) return true;
		Periodical other = (Periodical)obj;
		return new EqualsBuilder()
			.append(getPeriodicalId(),other.getPeriodicalId())
			.isEquals();
	}
}

